You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow reviewed exceptions to related-hold blocks - #1545
An author may legitimately have multiple distinct
theses with holds. We need an affordance for
processors to override the publication block in
such cases.
Why these changes are being introduced:
An author may legitimately have multiple distinct
theses with holds. We need an affordance for
processors to override the publication block in
such cases.
Relevant ticket(s):
- [ETD-704](https://mitlibraries.atlassian.net/browse/ETD-704)
- [ETD-689](https://mitlibraries.atlassian.net/browse/ETD-689)
How this addresses that need:
- Adds a field to the the processing form that
allows processors to override the publication
block for related theses.
- Manages exceptions to publication blocks in a
model that's backed by PaperTrail.
- Refreshes publication readiness when holds are
saved, reassigned, or deleted.
- Rechecks holds before queuing publication and
when publication jobs run.
Side effects of this change:
Existing stale readiness statuses are not
automatically fixed. However, this is a highly
unlikely edge case.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The change introduces synchronous N+1 queries across publication batches and can reject unchanged unchecked exceptions after hold removal, discarding metadata edits.
This PR lets processors waive publication blocks caused by holds on distinct related theses, while preserving direct holds and other readiness requirements.
Changes:
Adds directional, audited exceptions and controls to grant or revoke them in the processing form.
Refreshes readiness when holds change and rechecks holds before queuing and executing publication.
Adds regression tests for authorization, audit history, rollback, and publication safeguards.
File
Description
test/models/related_hold_exception_test.rb
Tests exception validation, persistence, rollback, and cleanup.
test/models/hold_test.rb
Tests readiness updates after hold changes.
test/jobs/dspace_publication_job_test.rb
Tests publication safeguards against current holds.
test/controllers/thesis_controller_test.rb
Tests review permissions, processing updates, and publication filtering.
Why these changes are being introduced:
A copilot review noted that stale unchecked hold
reviews could reject valid metadata edits.
Additionally, publication candidate selection
led n+1 queries.
Relevant ticket(s):
- [ETD-704](https://mitlibraries.atlassian.net/browse/ETD-704)
How this addresses that need:
- Absent unchecked related-thesis exceptions are
now treated as no-ops.
- Publication candidates are now selected through
one SQL query.
Side effects of this change:
We don't typically insert SQL queries in scopes,
but it seemed like the least-bad option in this
case.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The attachment-race retry can reuse a stale association from the rolled-back attempt, skip recreating the exception, and lose the processor’s decision; reload the association before building the lookup.
Reload persisted exceptions before retrying attachment association
app/models/related_hold_exception.rb:48
On the attachment-race retry, this association can still contain the exception created during the first attempt even though that attempt's transaction rolled back. Reusing the same thesis object then treats the rolled-back exception as existing, so line 52 skips recreating it and the successful retry loses the processor's decision. Reload the association before building this lookup so each attempt uses persisted exceptions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why these changes are being introduced:
An author may legitimately have multiple distinct
theses with holds. We need an affordance for
processors to override the publication block in
such cases.
Relevant ticket(s):
How this addresses that need:
block for related theses.
Side effects of this change:
Existing stale readiness statuses are not
automatically fixed. However, this is a highly
unlikely edge case.
Developer
Accessibility
New ENV
Approval beyond code review
Additional context needed to review
It's easiest to test using the preseeded data in the staging db. I've loaded a copy of that db into the review app.
Code Reviewer
Code
added technical debt.
Documentation
(not just this pull request message).
Testing